﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Web;

namespace OnlineMediaAnalyzer.Models
{
    public class Category
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Name is required")]
        [StringLength(64, ErrorMessage = "Name length should be less than 64")]
        public string Name { get; set; }

        [StringLength(128, ErrorMessage = "Url length should be less than 128")]
        public string Url { get; set; }

        public int FeedID { get; set; }
        public virtual Feed Feed { get; set; }

        public virtual ICollection<Article> Articles { get; set; } 

        [StringLength(32)]
        public string Self
        {
            get
            {
                return string.Format(CultureInfo.CurrentCulture,
                    "api/categories/{0}", this.ID);
            }
            set { }
        }
    }
}